.\" Manpage for nxfuse
.TH NXFUSE "1" "January 2016" "1.2" "User Commands"
.SH NAME
nxfuse \- mount NuttX filesystems using FUSE
.SH SYNOPSIS
.B nxfuse
[\fIOPTION\fR]... [\fIFUSE-OPTION\fR]... \fIdir\fR \fIdatasource\fR
.PP
.B nxfuse
-h \fIdir\fR
.PP
.B nxfuse
-m [\fIOPTION\fR]... \fIdatasource\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
Mount or create (-m option) a NuttX filesystem on \fIdatasource\fR (file or block device).  
Using the first invocation format, the NuttX filesystem contained on \fIdatasource\fR will 
be mounted as a native Linux filesystem at the mount point specified by \fIdir\fR.  As with
any Linux mount point, this directory must exist prior to invocation of nxfuse.
.SH OPTIONS
.TP
\fB\-e\fR erasesize 
set the \fIdatasource\fR erase block size
.TP
\fB\-g\fR fs_specific_data 
sets generic, filesystem specific data used during mkfs
.TP
\fB\-l\fR sectsize
set the filesystem logical sector size
.TP
\fB\-m\fR
create (mkfs) a new NuttX filesystem on \fIdatasource\fR  
.TP
\fB\-p\fR pagesize
set the \fIdatasource\fR page read/write size
.TP
\fB\-t\fR fstype
specify the NuttX filesystem type (smartfs, nxffs, etc.)
.TP
\fB\-v\fR
report the nxfuse version
.SH FUSE-OPTIONS
For a list of FUSE options, use the second invocation format or 'man fuse'.
.SH GENERIC ARGUMENT
Filesystem specifc data is passed using the -g generic data argument.  The format and meaning 
of the generic data is filesystem specific, but in general will consist of a comma separated
list of options.  Details for currently implemented generic arguments are detailed below.
.TP
\fBSMARTFS\fR
.br
When nxfuse has been compiled with SmartFS MULTI_ROOT_DIR support, the -g generic data argument 
will be a simple integer representing the root directory number to be mounted (1-8) during 
mount operations, or the number of root directories to create during mkfs operations.
.PD 1
.TP 14
\fB       nxfuse\fR -t smartfs -g 3 /tmp/smart /tmp/smartfs.bin
Mounts directory number 3 (equivalent to /dev/smart0d3) within the /tmp/smartfs.bin file at mount point /tmp/smart.
.LP
.TP 14
\fB       nxfuse\fR -t smartfs -m -c -g 4 /tmp/smartfs.bin
Reformats /tmp/smartfs.bin with a new filesystem containing 4 root directory entries.
.SH EXAMPLES
.LP
.TP
\fBdd\fR if=/dev/zero of=/tmp/smart.bin bs=1024 count=2048
.PD 0
.TP
\fBnxfuse\fR -m -t smartfs /tmp/smart.bin
.PD 1
.IP
Creates a RAM based, zero-filled 2 MByte file and initializes it with a new SmartFS filesystem (mkfs).
.LP
.TP
\fBnxfuse\fR -t smartfs /tmp/smart /tmp/smart.bin
.PD 1
.IP
Mounts the SmartFS filesystem contained within /tmp/smart.b at the mount point /tmp/smart
.LP
.TP
\fBdd\fR if=/dev/zero of=/tmp/nxffs.bin bs=1024 count=8192
.PD 0
.TP
\fBmkdir\fR /tmp/nxffs
.LP
.TP
\fBnxfuse\fR -t nxffs -e 32768 /tmp/nxffs /tmp/nxffs.bin
.PD 1
.IP
Creates a RAM based, 8 MByte file, initializes it with a new NXFFS filesystem and mounts it at /tmp/nxffs.
.TP
\fBnxfuse\fR -t smartfs -e 2048 -o allow_other /tmp/smart /dev/loop0
.PD 1
.IP
Mounts the SmartFS filesystem managed by the block device /dev/loop0 at the mount point /tmp/smart
with a block erase size of 2KB.
Since /dev/loop0 is a root acceess device, this command will likely need to be executed with sudo.  
In this case, the -o allow_other FUSE option causes FUSE to setup the mount at /tmp/smart such that it
can be accessed by any user.
.TP
\fBnxfuse\fR -m -c -l 256 -e 32768 -b 256 -t smartfs /tmp/smart.bin
.PD 1
.IP
Creates or re-creates a SmartFS filesystem in /tmp/smart.bin with a logical sector size of 256 bytes 
and a block erase size of 32K bytes.  This overrides whatever sizes had been compiled into nxfuse
based on the config file that was copied from the NuttX directory.
.LP
.TP 14
       NOTE:
When mounting the /tmp/smart.bin file, the '-e 32768' and '-b 256' options will need to be 
supplied on the nxfuse command line for proper mounting.  The logical sector size is stored 
withing the SmartFS filesystem, but the erase block and page sizes of the underlying 
file-based "block device" are not.
.SH AUTHOR
Written by Ken Pettit.
.SH "REPORTING BUGS"
Report nxfuse bugs to pettitkd@gmail.com
.SH COPYRIGHT
Copyright \(co 2016 Ken Pettit
.br
License: BSD-style 3 clause license
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
fusermount(2) - Unmount a FUSE filesystem
